package cn.wolfcode.luowowo.article.query;

import cn.wolfcode.luowowo.common.query.QueryObject;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class TravelQuery extends QueryObject{

    private Long destId = -1L;
    private String orderBy = "t.createTime desc ";  //默认是最新
    private int perExpendType = -1;  //人均消费
    private int travelTimeType = -1;    //旅游时间
    private int dayType = -1;       //旅游天数
    private Long authorId=null;
    private int orderType = 1;  //排序 默认是最新

    public String getOrderBy(){
        if(orderType == 1){
           return "t.createTime desc " ;
        }else{
            return "t.viewnum desc";   //最热门
        }
    }

    //将页面传入key值转换成范围对象
    public TravelCondition getPerExpend(){
        return TravelCondition.TRAVEL_PER_EXPEND.get(perExpendType);
    }
    //旅游时间
    public TravelCondition getTravelTime(){
        return TravelCondition.TRAVEL_TIME.get(travelTimeType);
    }
    //旅游天数
    public TravelCondition getDay(){
        return TravelCondition.TRAVEL_DAYS.get(dayType);
    }

}
